package lxy;

import java.io.File;
import java.io.FileWriter;
import java.util.Dictionary;

public class Workt4 {
    public static void t1(){
        File file = new File("E:\\Test");
        if (!file.exists()){
            file.mkdirs();
            System.out.println("文件夹创建成功");
        }else {
            System.out.println("文件夹已存在");
        }
    }
    public static void t2()throws Exception{
        File file1 = new File("E:\\Test\\1.txt");
        File file2 = new File("E:\\Test\\2.txt");
        File file3 = new File("E:\\Test\\3.txt");
        System.out.println(file1.createNewFile());
        System.out.println(file2.createNewFile());
        System.out.println(file3.createNewFile());

        FileWriter fw = new FileWriter("E:\\Test\\3.txt");
        fw.write("欢迎来到讯方学院");
        fw.close();

    }
    public static void main(String[] args) throws Exception{
        t1();
        t2();
    }
}
